package com.snack.shop.common;

/**
 * 退款状态常量
 * 
 * @author 阿狄
 * @date 2025-11-13
 */
public class RefundStatus {
    
    /** 无退款 */
    public static final int NO_REFUND = 0;
    
    /** 退款审核中 */
    public static final int REVIEWING = 1;
    
    /** 退款成功 */
    public static final int SUCCESS = 2;
    
    /** 退款被拒绝 */
    public static final int REJECTED = 3;
    
    /**
     * 获取退款状态文本
     * @param status 退款状态
     * @return 状态文本
     */
    public static String getStatusText(Integer status) {
        if (status == null) {
            return "无退款";
        }
        
        switch (status) {
            case NO_REFUND:
                return "无退款";
            case REVIEWING:
                return "退款审核中";
            case SUCCESS:
                return "退款成功";
            case REJECTED:
                return "退款被拒绝";
            default:
                return "未知状态";
        }
    }
    
    /**
     * 判断是否可以申请退款
     * @param refundStatus 当前退款状态
     * @return true-可以申请，false-不可以申请
     */
    public static boolean canApplyRefund(Integer refundStatus) {
        return refundStatus == null || refundStatus.equals(NO_REFUND) || refundStatus.equals(REJECTED);
    }
    
    /**
     * 判断是否正在退款流程中
     * @param refundStatus 当前退款状态
     * @return true-正在退款流程中，false-不在退款流程中
     */
    public static boolean isRefunding(Integer refundStatus) {
        return refundStatus != null && (refundStatus.equals(REVIEWING) || refundStatus.equals(SUCCESS));
    }
}
